home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Just Call Me Internet
/
Just Call Me Internet.iso
/
com
/
computer
/
casio_st
/
prog_fx
/
divers
/
zeropoly.sha
< prev
Wrap
Text File
|
1994-03-01
|
2KB
|
28 lines
10 REM RESOLUTION POLYNOME DE DEGRE N
20 REM TELECHARGE SUR WILLYTEL
30 REM 24H/7H AU 62.93.74.05
40 CLS:PRINT "P=a0+a1x+a2x^2+...+anx^n";CHR$(13);
50 CLEAR :INPUT "n=";G:F=G:DIM A(G),B(G),C(G),D(G):FOR I=G TO 0 STEP-1:PRINT "a";I;:INPUT "=";A(I):NEXT I
60 FOR I=G TO 0 STEP-1:IF A(I)>=0 THEN S$="+" ELSE S$="-"
70 A$=STR$(A(I)):I$=STR$(I):LA=LEN(A$):LI=LEN(I$):A$=RIGHT$(A$,LA-1):I$=RIGHT$(I$,LI-1)
80 P$=P$+S$+A$+"x^"+I$:NEXT I:CLS:PRINT P$+"=0"
90 P=1E-4:N=1E-9:FOR I=G TO 0 STEP-1:D(I)=A(I):NEXT I:IF G<=2 GOTO 230
100 A=0:H=1:K=-1:B(G)=A(G):C(G)=A(G)
110 B(G-1)=B(G)*H+A(G-1):C(G-1)=B(G-1)+B(G)*H
120 FOR I=G-2 TO 0 STEP-1:B(I)=B(I+2)*K+B(I+1)*H+A(I):C(I)=C(I+2)*K+C(I+1)*H+B(I):NEXT I
130 C=C(2)*C(2)-C(1)*C(3):IF C=0 THEN PRINT "Autres Val.Dep":END
140 O=H-(B(1)*C(2)-B(0)*C(3))/C:D=K-(B(0)*C(2)-B(1)*C(1))/C
150 IF ABS(B(0))<P AND ABS(B(1))<P GOTO 190
160 IF ABS(O-H)<N AND (D-K)<N THEN PRINT "Iterat.Creee":END
170 A=A+1:IF A>40 THEN PRINT "To Slow":END
180 H=O:K=D:GOTO 110
190 L=O/2:M=O*O+4*D:IF M<0 GOTO 210
200 Q=L+SQRM/2:PRINT "x=";Q:GOSUB 270:Q=L-SQRM/2:PRINT "x=";Q:GOSUB 270:GOTO 220
210 PRINT L;CHR$(249);SQR-M/2;"j"
220 FOR I=2TOG:A(I-2)=B(I):NEXT I:G=G-2:IF G>2 GOTO 100
230 IF G=1 THEN Q=A(0)/-A(1):PRINT "x=";Q:GOSUB 270:END
240 L=-A(1)/(2*A(2)):M=A(1)*A(1)-4*A(2)*A(0):IF M<0 GOTO 260
250 Q=L+SQRM/(2*A(2)):PRINT "x=";Q:GOSUB 270:Q=L-SQRM/(2*A(2)):PRINT "x=";Q:GOSUB 270:END
260 PRINT L;CHR$(249);SQR-M/(2*A(2));"j":END
270 B=0:FOR I=1 TO F:B=B+D(I)*Q^I:NEXT I:B=B+D(0):PRINT "f(x)=";B:RETURN